﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using System.Web;

namespace MailTool.Utility
{
    public class ParamHandler
    {
        /// <summary>
        /// 判断参数是否合法(可转为Int)
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        public static bool IsLegalForInt(string param)
        {
            if (IsLegalForString(param))
            {
                Regex regex = new Regex("^[0-9]*[0-9][0-9]*$");
                if (regex.IsMatch(param))
                {
                    return true;
                }
            }
            return false;
        }
        /// <summary>
        /// 判断参数是否合法(可转为String)
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        public static bool IsLegalForString(string param)
        {
            if (!string.IsNullOrEmpty(param))
            {
                return true;
            }
            return false;
        }

    }
}